<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.sanqing.po.Department" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>人力资源管理系统</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.tabfont01 {	
	font-family: "宋体";
	font-size: 9px;
	color: #555555;
	text-decoration: none;
	text-align: center;
}
.font051 {font-family: "宋体";
	font-size: 12px;
	color: #333333;
	text-decoration: none;
	line-height: 20px;
}
.font201 {font-family: "宋体";
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.button {
	font-family: "宋体";
	font-size: 14px;
	height: 37px;
}
html { overflow-x: auto; overflow-y: auto; border:0;} 
-->
</style>

<link href="../css/css.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">

</script>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function setId(obj)
{
var e=getElementsByClassName("list");
for(var i=0;i<e.length;i++)
{
  e[i].bgColor="white";
}
var nodes=document.getElementById(obj.id).childNodes;
var name;
for(i=0;i<nodes.length;i++)
{
 if(nodes[i].className=="name")
   name=nodes[i].innerHTML;
}
document.getElementById("id").value=obj.id+"-"+name;
obj.bgColor="#6795B4";
}
function getElementsByClassName (className) {
  var all = document.getElementsByTagName('tr');
  var elements = new Array();
  for (var e = 0; e < all.length; e++) {
    if (all[e].className == className) {
       elements[elements.length] = all[e];
      }
  }
  return elements;
}

</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td height="30">      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="62" background="images/nav04.gif">&nbsp;</td>
        </tr>
    </table></td></tr>
  <tr>
    <td><table id="subtree1" style="DISPLAY: " width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>
			<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td height="20"><span class="newfont07">部门信息查看</span></td>
				</tr>
				<tr>
					<td height="40" class="font42">
<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">
	<tr class="CTitle" >
		<td height="22" colspan="6" align="center" style="font-size:16px">部门信息列表</td>
	</tr>
	<tr bgcolor="#EEEEEE">
		<td width="10%" align="center" height="30">部门编号</td>
		<td width="10%" align="center" >部门名称</td>
		<td width="10%" align="center" >上级部门</td>
		<td width="10%" align="center" >联系电话</td>
		<td width="50%" align="center" >部门简介</td>
	 </tr>
	<% 
	List depts=(List)request.getAttribute("depts");
	if(depts.size()>0){
	Iterator it=depts.iterator();
	while(it.hasNext()){
	Department dept=(Department)it.next();
	%>
	<tr id="<%=dept.getId()%>" class="list" bgcolor="#FFFFFF" onclick="setId(this)">
		<td height="22" align="center"><%=dept.getId()%>&nbsp;</td>
		<td height="22" align="center" class="name"><%=dept.getName() %></td>
		<td height="22" align="center">
		<%if(dept.getParent()!=null){out.print(dept.getParent().getName());}%>&nbsp;
		</td>
		<td height="22" align="center" ><%=dept.getPhone() %>&nbsp;</td>
		<td height="22" align="center" ><%=dept.getIntroduction() %>&nbsp;</td>
	</tr>
	<%}}else{ %>
    <tr  bgcolor="#FFFFFF">
		<td height="22" colspan="6" align="center" >对不起，暂时没有部门信息！！！</td>
	</tr>
	<%} %>
</table>
            </td>
        </tr>
      </table>
          </td>
        </tr>
</table>
<p align="center">
<input type="hidden" id="id" value="1"/>
<input type="button" name="Submit" value="确认" onClick="javascript:window.returnValue=document.getElementById('id').value;self.close();"/>
</p>
</body>
</html>

